package com.example.bob.bundletest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


/**
 * Created by Bob on 2016/3/8.
 */
public class ResultActivity extends Activity{

    private TextView textView;
    private Button btnBack;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_result);
        btnBack = (Button)findViewById(R.id.btnBack);
        btnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent();
                i.putExtra("result","BackMessage");
                setResult(0, i);
                finish();
            }
        });
        textView = (TextView)findViewById(R.id.resultView);

        Bundle bundle  = getIntent().getExtras();
        String message = bundle.getString("message");

        textView.setText(message);
    }
}
